﻿if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fd_Document_get_by_id]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[fd_Document_get_by_id]
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE fd_Document_get_by_id
(
	@id int
)
AS

BEGIN

	SET NOCOUNT ON
	
				
   	BEGIN TRY
   		
   		select	* from Documentos where id = @id		
   		
   	END TRY
   	
   	BEGIN CATCH
   		DECLARE 	@ErrorNumber	INT,
				@ErrorSeverity	INT,
				@ErrorState		INT,
				@ErrorProcedure NVARCHAR(126),
				@ErrorLine		INT,
				@ErrorMessage	NVARCHAR(4000)
				
   		SELECT		@ErrorNumber = ERROR_NUMBER(),
				@ErrorSeverity = ERROR_SEVERITY(),
				@ErrorState = ERROR_STATE(),
				@ErrorProcedure = ERROR_PROCEDURE(),
				@ErrorLine = ERROR_LINE(),
				@ErrorMessage = ERROR_MESSAGE()
				
   		RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState)
   	END CATCH
END

GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO